package com.wing.productionPlan.dao;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.wing.enterprise.product.model.entity.ResBenchmarkBookEchnology;
import com.wing.productionPlan.model.entity.ProductionTheWorkOrder;
import com.wing.productionPlan.model.entity.ProductionWorkOrder;
import com.wing.productionPlan.model.response.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * 生产报工单-Dao
 *
 * @author
 */
@Mapper
public interface ProductionTheWorkOrderDao extends BaseMapper<ProductionTheWorkOrder> {

    /**
     * 列表-app
     *
     * @param params
     * @return
     */
    List<ProductionTheWorkOrderVO> list4app(@Param("params") Map<String, Object> params);

    /**
     * 分页列表-app
     *
     * @param page
     * @param params
     * @return
     */
    List<ProductionTheWorkOrderVO> list4app(@Param("page") Page<ProductionTheWorkOrderVO> page, @Param("params") Map<String, Object> params);

    /**
     * 详情-app
     *
     * @param id
     * @return
     */
    ProductionTheWorkOrderVO get4appById(Long id);

    Page<ProductionTheWorkOrderVO> getProductionTheWorkOrderVOPageList(IPage<ProductionTheWorkOrderVO> page, @Param("params") Map<String, Object> params, @Param("ew") QueryWrapper<ProductionTheWorkOrder> queryWrapper);

    /**
     * 查询工序报工信息
     *
     * @param id
     * @return
     */
    ProductionTheWorkOrderVO selectTheWorkOrderInfo(@Param("id") Long id);

    /**
     * 查询工单的报工合格总数
     *
     * @param workOrderId
     * @return
     */
    Integer getWorkOrderQualifiedSum(@Param("workOrderId") Long workOrderId);

    /**
     * 查询计划的报工合格总数
     *
     * @param productionPlanId
     * @return
     */
    Integer getPlanQualifiedSum(@Param("productionPlanId") Long productionPlanId);

    /**
     * 查询报工单详情
     * @param id
     * @return
     */
    ProductionTheWorkOrderSearchVO getDetailBy(@Param("id") Long id);

    /**
     * 查询质检总数量
     * @param id
     * @return
     */
    WorkOrderSendTotallVO getTotalBy(@Param("id") Long id);

    /**
     * 查询工艺流程卡
     * @param id
     * @return
     */
    ProcessCardInfoVo getCardInfoBy(@Param("id") Long id);

    /**
     * 查询开工单打印信息
     * @param id
     * @return
     */
    ProWorkOrderPrintVo getWorkOrderPrint(@Param("id") Long id);

    /**
     * 获取报工单打印信息
     * @param id
     * @return
     */
    ProductionTheWorkPrintVO getPrintTheWork(@Param("id") Long id);

    /**
     * 根据开工单id获取基准书信息
     *
     * @author zhutao
     * @since 2025-06-10 11:35
     * @param id
     * @return com.wing.enterprise.product.model.entity.ResBenchmarkBookEchnology
     */
    ResBenchmarkBookEchnology getBenchBookEchByTheWorkOrderId(Long id);
}
